var app = getApp()
var QQMapWX = require('../../utils/qqmap-wx-jssdk.js');
Page({
  data: {
    objarr: [],
    height:0,
    width:0,
    page: 1,
    pagesize: 10,
    totalpage: 0,//最大页数
    nomore: true
  },
  onLoad: function (options) {
    var that = this;
    
    wx.getSystemInfo({
      success: function (res) {
        console.log(res);
        that.setData({
           width: res.windowWidth,
           height:res.windowHeight })
      }
    })
    let par = {
      page:this.data.page,
      page_size:this.data.pagesize
    }
    app.ajax("member_wish_list", par, (data, err) => {
      if (data.data.list.length != 0) {
        this.setData({
          objarr : data.data.list,
          totalpage: data.data.total_page
        })
      }
      
    })
  },
  
  //滑动到底部 上拉加载
  scrollBottom: function () {
    this.data.page++
    if (this.data.page > this.data.totalpage) {
      this.setData({
        nomore: false
      })
    } else {
      let params = {
          page: this.data.page,
          page_size: this.data.pagesize
        }
      app.ajax('member_wish_list', params, (data, err) => {
        let arr = this.data.objarr;
        for (let item of data.data.list) {
          arr.push(item);
        }
        this.setData({
          objarr: arr
        })
      })
    }

  },
 
});